Introduction to the
development process
Outline
|
|
|
Programming |
|
Programming languages and its
classification |
|
History of C/C++ |
|
Console / Event-driven applications |
|
The program development process |
Programming
|
|
|
Programming applies to the discipline
of developing a program from a design specification. This includes: |
|
Elements of the subsystems (e.g.,
choices of data structures such as linked list versus fixed arrays) |
|
Order of implementation of subsystems |
|
Algorithm choices (e.g. which variant
of quicksort to use based on the expected order of inputted data) |
|
Code implementation |
|
|
Programming
languages
Definitions
|
|
|
|
A program is instructions to the
computer to do something (for example, solve a problem). |
|
A programming language is a language
for writing programs. Both computers and humans must understand the language. |
|
Machine language |
|
Assembly language |
|
High-level language |
|
Human language |
Programming languages
Classification
|
|
|
|
|
Machine Language |
|
Computers only understand machine
language. Unfortunately, humans can not understand it. Example of machine
language:
1100 1010 1111 1110 1011 1010 1011 1110 |
|
Assembly Language |
|
In this language, a programmer writes
every machine instruction, but in codes that are easier to understand.
Assembly language is no longer used very often. For example, |
|
Bipus |
|
Iload_2 |
|
|
Programming languages
Classification (Cont.)
|
|
|
|
|
High-level Language |
|
This is the type of programming
langauge that is used most of the time. It's possible for the machine to
translate it to machine instructions, and humans can also understand it with
some practice. There are thousands of programming languages, but only a few
are popular, for example Pascal, C, C++, Visual Basic, and Java. You will
soon see many examples of Java programs. |
|
Human Language |
|
The problem is that computers can not
understand human languages very well. Many researchers have been working hard
for 40 years on this problem, but the progress is slow. Example: English, Spanish, French,… |
Programming languages and
two ways of programming
|
|
|
|
|
|
|
Procedural (Imperative) Languages |
|
Object-Oriented (OO) Languages |
Procedural (Imperative)
Languages: Definition
|
|
|
Example: PASCAL, C, FORTRAN |
|
These languages support procedurally
oriented design. Emphasis is on the tasks that must be performed. Normally,
one must write a separate function or procedure for each data type for which
the task must be performed. |
|
Modular procedural design groups source
code by its function |
Procedural (Imperative)
Languages: Structure
|
|
|
Source = Implementation |
|
|
|
Input.cc |
|
Output.cc |
|
Array.cc |
|
Etc.. |
Procedural Programming
Object-Oriented (OO)
Languages
|
|
|
Example: C++, Objective C, Java |
|
OO languages have features which
directly support software development using an object oriented paradigm. The
emphasis is on the classes (or categories) of data that are present, and the
software design is organized around the defined types. |
Object-Oriented Language
|
|
|
Source = Implementation |
|
|
|
Complex.cc |
|
String.cc |
|
Window.cc |
|
Etc.. |
Modular programming
History of
C/C++
Development of C
|
|
|
UNIX developed c. 1969 – DEC PDP-7
Assembly Language |
|
BCPL – a user friendly OS providing
powerful development tools developed from BCPL. Assembler tedious long and
error prone. |
|
A new language “B” a second attempt. C.
1970 |
|
A totally new language “C” a successor
to “B”. C. 1971 |
|
By 1973 UNIX OS almost totally written
in “C” |
History of
C/C++
From C to C++
|
|
|
|
The C programming language was
originally developed by Dennis Ritchie in 1972. |
|
Two major dialects of C have been
available during the history : |
|
Traditional C |
|
ANSI C |
|
C++ is built on the base of C by Bjarne
Stroustrup in the early 1980’s. |
Characteristics of C
|
|
|
Small size |
|
Extensive use of function calls |
|
Loose typing – unlike PASCAL |
|
Structured language |
|
Low level (BitWise) programming readily
available |
|
Pointer implementation – extensive use
of pointers for memory, array, structures and functions |
Traditional C and ANSI C
|
|
|
An ANSI C compiler will accept programs
written in traditional C (but not vice versa) |
|
ANSI C compiler can catch certain
common programming errors in an ANSI C program that would not be caught in a
traditional C program. |
|
|
|
|
C++
|
|
|
includes several improvements to C |
|
has many new features designed to support object-oriented
programming |
|
retains the basic features of ANSI C |
C++
5 directions of C enhancement
|
|
|
C++ offers enhancements of C in five
directions: |
|
Operator and function overloading |
|
Information hiding |
|
Inheritance |
|
Polymorphism (virtual functions) |
|
Library building (templates,
exceptions) |
Reasons of C as a
professional language
|
|
|
It has high-level constructs. |
|
It can handle low-level activities. |
|
It produces efficient programs. |
|
It can be compiled on a variety of
computer. |
Applications:
|
|
|
Console applications |
|
Event-driven applications |
Console Applications
|
|
|
are programs written without a
Graphical User Interface (GUI). |
|
is run in a Windows console window. |
|
don’t require much user input and
perform a limited set of functions. |
|
|
|
The visual controls of the Visual
Component Library (VCL)normally used in Window programming are not used in
console applications. |
Event-driven Applications
|
|
|
are programs written with a Graphical
User Interface (GUI). |
Graphical User Interfaces
(GUIs)
|
|
|
|
User centric programming. |
|
Program is not in charge. |
|
The flow of control is not fixed. |
|
User/system creates high level software
events. |
|
Action button has been pressed ... |
|
Left mouse button has been released ... |
|
Window has been closed ... |
|
Scrollbar was adjusted ... |
|
Program processes events. |
|
Different design patterns exist of how
system creates events and program should handle the events. |
The development process
|
|
|
Development process is a set of rules
which define how a development project should generally be carried out. This
may include a description of what documents, design models and other
artifacts should be produced and in what order. |
Software Development
Cycle
Structure
Software Development
Cycle
Design
|
|
|
First the program has to be designed.
It can be written on paper, or in designer’s head, but the designer should
have a clear idea of what he want to do before he start writing your program. |
Software Development
Cycle
Edit
|
|
|
Write the source program using an editor.
An editor is like a simple word processor. A source program contains
instructions in a programming language (eg, Java). |
|
Example editor: PFE (Programmer's File
Editor) |
Software Development
Cycle
Compile
|
|
|
Translate (compile) the source program
into an object program.
An object program contains machine instructions. The program which
translates a source program into an object program is called a compiler. If
there are errors, go back to step 2 (or 1). Don't be surprised if you have to
go back and edit your program many times. |
|
Example compiler: javac (part of Sun's
JDK (Java Development Kit)) |
Software Development
Cycle
Run
|
|
|
Run (execute) the object program. This
step is often called debugging. A bug is an error in the program. You debug a
program to remove the bugs in a program.
If there are errors, go back to step 2 (or 1). |
|
Example way to run applets: appletviewer |
Development process
with Microsoft C
|
|
|
Creating the source file FIRST.C |
|
Compiling FIRST.C to create FIRST.OBJ |
|
Linking FIRST.OBJ to create FIRST.EXE |
|
Executing FIRST.EXE to verify its
performance |
Example 1:
The development cycle
Software Development with
Feedback
Glossary
|
|
|
C compiler A software program that
examines a C program for syntax errors and, if successful, creates an object
(OBJ) file. |
|
Editor A program that allows you to
create or change a file. |
|
Linker A software program that combines
object (OBJ) and library (LIB) files to create an executable program that has
the extension EXE. |
|
Object file A machine code file
produced by compilation of source code. |
Glossary (Cont.)
|
|
|
Program A list of instructions for the
computer to perform. C programmers refer to these instructions as source
code. Programs are also known as software. |
|
Source Code The processing instructions
that are written in a given computer language and that collectively
constitute a source file. |
|
Source File A text file that contains a program. C source files have the
extension C: filename.c |
|
Syntax Error An error that occurs when
you violate one of the rules of C, such as forgetting ‘;’. |